﻿<p class="text-info">
    PEDIDOS
</p>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span8">

            <!-- items -->
            <table class="table table-bordered">

                <!-- header -->
                <tr class="well">
                    <td><b>Item</b></td>
                    <td class="tdCenter"><b>Quantity</b></td>
                    <td class="tdRight"><b>Price</b></td>
                    <td />
                </tr>

                <!-- empty cart message -->
                <tr ng-hide="cart.getTotalCount() > 0" >
                    <td class="tdCenter" colspan="4">
                        Your cart is empty.
                    </td>
                </tr>

                <!-- cart items -->
                <tr ng-repeat="item in cart.items | orderBy:'name'">
                    <td>{{item.name}}</td>
                    <td class="tdCenter">
                      <div class="input-append">
                        <!-- use type=tel instead of  to prevent spinners -->
                        <input
                            class="span3 text-center" type="tel" 
                            ng-model="item.quantity" 
                            ng-change="cart.saveItems()" />
                        <button 
                            class="btn btn-success" type="button" 
                            ng-disabled="item.quantity >= 1000"
                            ng-click="cart.addItem(item.sku, item.name, item.price, +1)">+</button>
                        <button 
                            class="btn btn-inverse" type="button" 
                            ng-disabled="item.quantity <= 1"
                            ng-click="cart.addItem(item.sku, item.name, item.price, -1)">-</button>
                       
                      </div>
                    </td>
                    <td class="tdRight">{{item.price * item.quantity | currency}}</td>
                    <td class="tdCenter" title="remove from cart">
                          <button 
                            class="btn btn-inverse" type="button" 
                            ng-click="cart.addItem(item.sku, item.name, item.price, -10000000)">Eliminar producto del pedido</button>
                    </td>
                </tr>

                <!-- footer -->
                <tr class="well">
                    <td><b>Total</b></td>
                    <td class="tdCenter"><b>{{cart.getTotalCount()}}</b></td>
                    <td class="tdRight"><b>{{cart.getTotalPrice() | currency}}</b></td>
                    <td />
                </tr>
            </table>
        </div>

        <!-- buttons -->
        <div class="span4">
            <p class="text-info">
                <button 
                    accesskey="5"
                    class="btn btn-block btn-danger" 
                    ng-click="saveShop()" 
                    ng-disabled="cart.getTotalCount() < 1" >
                    <i class="icon-trash icon-white" /> Guardar el pedido
                </button>
                <button 
                    accesskey="0"
                    class="btn btn-block btn-danger" 
                    ng-click="cart.clearItems()" 
                    ng-disabled="cart.getTotalCount() < 1" >
                    <i class="icon-trash icon-white" /> Limpiar el los datos del pedido
                </button>
            </p>
                <!-- Stripe needs a form to post to -->
                <form class="form-stripe"></form>
                
                <ul>
                    <li> Limpiar pedido  Alt + 0
                    <li> Limpiar pedido  Alt + 5
                        
        </div>
    </div>
</div>
